#ifndef DOCINFOCENTER_H_HEADER_INCLUDED_B4F2BEC9
#define DOCINFOCENTER_H_HEADER_INCLUDED_B4F2BEC9

#include "../definition.h"
#include "../utils.h"
#include "DocInfoDBBase.h"

class DocInfoCenter: public Singleton<DocInfoCenter>
{
public:
    enum DATABASE_TYPE
    {
        XML,
        SQLITE,
    };
    
public:
    void Create(STRING depotPath = wxT("depot"),
                  DATABASE_TYPE = XML );
    ~DocInfoCenter();

    // doc info oprations
    VEC_STRING GetAllFolders(){ return m_db->GetAllFolders(); };
    VEC_STRING ListFolder(STRING folder);

    bool UpdateDocInfo(void* cmdInfo = 0);
    bool UpdateDocContent(void*cmdInfo = 0);
    DocInfomation LoadInfo(STRING docName);

    STRING CopyDoc(STRING filePath, STRING catagory);

    DocInfomation ReadInfoFromFile(STRING docName, STRING folder);
    DocInfomation ReadInfoFromFile(PATH pathDoc);
    void SaveInfo(DocInfomation info);

    void SetDepotPath(STRING path);

    PATH GetFullPath(STRING filename, STRING folder);
    STRING GetFullPathString(STRING filename, STRING folder);
protected:
    PATH            m_depotPath;
    DocInfoDBBase*  m_db;
protected:
    void updateAllFolders();
    void createFolder(STRING folderName);
};



#endif /* DOCINFOCENTER_H_HEADER_INCLUDED_B4F2BEC9 */
